<template>
    <div class="nav">
      <div class="back"  @click="path()">
        <div class="back-btn" v-show="back===true"></div>
      </div>
      <h3 class="title ellipsis"><slot></slot></h3>
      <div class="right"></div>
    </div>
</template>

<script>
export default {
  props:{
    back:Boolean
  },
  methods:{
    path(){
      this.$router.push({path:"/"})
    }
  }
}
</script>

<style lang="less" scoped>
.nav{
  position: fixed;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 38px;
  padding: 6px 0px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  background: #f03d37;
  z-index: 5;
  .title{
    font-size: 18px;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    line-height: 50px;
    font-size: 18px;
    font-weight: 400;
    text-align: center;
  }
  .back{
    width: 50px;
    // height: 100%;
    line-height: 50px;
    // position: absolute;
    // top: 47%;
    // left: 10px;
    // transform: translateY(-50%);
    vertical-align: middle;
    .back-btn{
      display: inline-flex;
      position: relative;
      width: 16px;
      height: 16px;
      left: 20px;
      vertical-align: middle;
      &::before{
          content: "";
          display: -webkit-box;
          display: -webkit-flex;
          display: flex;
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          box-sizing: border-box;
          border-bottom: 2px solid #fff;
          border-left: 2px solid #fff;
          -webkit-transform: rotate(45deg);
          transform: rotate(45deg);
      }
    }
  }
  .ellipsis {
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
  }
  .right{
      width: 50px;
      height: 100%;
      line-height: 50px;
  }
}

</style>